package com.csair.irp.job.file.parser.base;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 *
 * </p>
 * 数据文件信息实体类
 * @author magicY
 * @since 2017-07-10
 */
@TableName("t_file_manage")
@ToString
@EqualsAndHashCode(callSuper = false)
public class FileManagePO extends Model<FileManagePO> {

	private static final long serialVersionUID = 1L;
	@TableId("file_manage_id")
    private Long fileManageId;
    @TableField("user_id")
    private long userId;
    @TableField("create_time")
    private Date createTime;
    @TableField("file_name")
    private String fileName;
    @TableField("file_sources")
    private Long fileSources;
    @TableField("link")
    private String link;
    @TableField("data_detail")
    private String dataDetail;
    @TableField("user_name")
    private String userName;
    @TableField("file_upload_date")
    private Date fileUploadDate;
    @TableField("file_state")
    private Integer fileState;

    /**
     * 数据文件解析状态
     */
    public enum StateEnum{
        STATE_ERROR_NOT_FOUND(-1,"未知错误","系统没识别到的异常异常"),
        STATE_NO_RUN(0,"未解析","数据文件信息已入库且未解析"),
        STATE_RUN_SUCCESS(1,"解析成功","数据文件信息已入库且文件数据已入库"),
        STATE_ERROR_TEMPLATE(2,"模板错误","表头和起始行不匹配，通过模板表校验"),
        STATE_ERROR_NOTFULL_CONTENT(3,"文件数据内容不全","旧调度保留字段，主要标志少列数据的情况"),
        STATE_ERROR_DATA_TYPE(4,"数据类型有误","数据类型错误，如：本应传数字的，而传过来了非数字的内容"),
        STATE_ERROR_ROWS_TOTAL_MONENY(5,"数据条数或总金额和实际数据不一致","判断数据内容是否出错了"),
        STATE_ERROR_DATABASE_INSERT(6,"数据入库失败","数据解析成功，但入库异常"),
        STATE_ERROR_CONTENT(8,"文件内容有误","某些列数据为空指定的错误异常"),
        STATE_ERROR_DOWNLOAD(10,"文件下载失败","ftp文件存在，但下载失败，一般由网络引起的")
        ;
        private int code;
        private String name;
        private String desc;
        StateEnum(int code,String name,String desc){
            this.code = code;
            this.name = name;
            this.desc = desc;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public String getDesc() {
            return desc;
        }

        @Override
        public String toString() {
            return "StateEnum{" +
                    "code=" + code +
                    ", name='" + name + '\'' +
                    ", desc='" + desc + '\'' +
                    '}';
        }
    }

    public Long getFileManageId() {
        return fileManageId;
    }

    public void setFileManageId(Long fileManageId) {
        this.fileManageId = fileManageId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Long getFileSources() {
        return fileSources;
    }

    public void setFileSources(Long fileSources) {
        this.fileSources = fileSources;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getDataDetail() {
        return dataDetail;
    }

    public void setDataDetail(String dataDetail) {
        this.dataDetail = dataDetail;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getFileUploadDate() {
        return fileUploadDate;
    }

    public void setFileUploadDate(Date fileUploadDate) {
        this.fileUploadDate = fileUploadDate;
    }

    public Integer getFileState() {
        return fileState;
    }

    public void setFileState(Integer fileState) {
        this.fileState = fileState;
    }

    @Override
    protected Serializable pkVal() {
        return this.fileManageId;
    }

}
